package com.kwt.learn.container;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Collection01 {
    public static void main(String[] args) {
        List<String> list = list();
        Iterator<String> iterator = list.iterator();
        iterator.remove();

        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).equals("nihao5")) {

                list.remove("nihao5");
            }
        }

        System.out.println(list);
    }


    /**
     * iterator 中删除
     */


    /**
     * 制做一个string list
     */

    public static List list() {
        ArrayList<String> strings = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            strings.add("nihao" + i);
        }
        return strings;
    }


}
